<ul class="nav navbar-nav mr-1">
    <li
            class="nav-item"
            style="cursor:pointer"
            wire:click="$dispatch('confirm-clean')"
    >
        <i class="feather icon-trash-2"></i>
        清除缓存
    </li>
</ul>

<script>
    document.addEventListener('livewire:init', () => {
        Livewire.on('confirm-clean', (event) => {
            Dcat.confirm('清除缓存', '确定要清除系统的缓存么?', () => {
                Livewire.dispatch('clean-cache')
            });
        });
        Livewire.on('cache-cleaned', (event) => {
            Dcat.swal.success(event.message).then(a => {
                Dcat.reload();
            });
        });
    });
</script>
